<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="弹窗.css">
    <script src="vue/vue.min.js"></script>

</head>
<body>
<div id="app" @click="b_hide=false">
<input type="button" id="btn" value="弹窗" @click.stop="func">
<div class="main" id="show" v-show="b_hide">
    <div class="big_box" ></div>
    <div class="middle_box" @click.stop="b_hide=true">
        <div class="small_box">系统提示
            <label id="x" @click.stop="func2">x</label></div>
        <P>请关注最近消息！</P>
        <div class="footer">还有<span id="time" v-model="num">{{num}}</span>
            秒自动关闭</div>
    </div>
</div>
</div>
</body>
<script>

    var timer = null;
    var vm = new Vue({
        el:"#app",
        data:{
            b_hide:false,
            num:5,
        },
        methods:{
            func:function () {
                vm.b_hide = true;
                timer = setInterval(function () {
                    vm.num--;
                    // console.log(vm.num);
                    if (vm.num < 1){
                        vm.b_hide = false;
                        clearInterval(timer);
                        timer = null;
                        vm.num = 5
                    }
                },1000)
            },
            func2:function () {
                vm.b_hide = false;
                // console.log(vm.num);
                clearInterval(timer);
                timer = null;
                vm.num = 5
            }
        }
    })
</script>
</html>